<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.db.conn"%>
<%@ page import="com.db.Pagination"%>
<%@ page import="java.sql.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
<jsp:include flush="true" page="${basePath}/admin/head.jsp"></jsp:include>
 </head>

 <body class="ms-body ms-aside-left-open ms-primary-theme ms-has-quickbar">
    <!-- Body Content Wrapper -->
    <div class="ms-content-wrapper">
        <div class="row">
            <div class="col-md-12">
                   <div class="ms-panel">
        <div class="ms-panel-header ms-panel-custome">
            <h6>管理章节信息</h6>
        </div>
        <div class="ms-panel-body">
            <div class="table-responsive">
                <table id="data-table10" class="table w-100 thead-primary">
                    <tr>
                        <td>
					
					
						 <table style="width:100%;" id="ctl001">
                       <tr>
                                    <td align="center">
                                           </td>
                                </tr>
                                 <tr>
                                    <td align="center">
                                          <%
//定义四个分页会用到的变量
int pageSize=15;
int pageNow=1;//默认显示第一页
int rowCount=0;//该值从数据库中查询
int pageCount=0;//该值是通过pageSize和rowCount
//接受用户希望显示的页数（pageNow）
String s_pageNow=request.getParameter("pageNum");
if(s_pageNow!=null){
//接收到了pageNow
pageNow=Integer.parseInt(s_pageNow);
}

String where="  1=1 ";

conn cn=new conn();


ResultSet rs=cn.query("select count(*) from bmore a where "+where);
if(rs.next()){
rowCount=rs.getInt(1);
}

//计算pageCount
if(rowCount%pageSize==0){
pageCount=rowCount/pageSize;
}else{
pageCount=rowCount/pageSize+1;
}
//查询出需要显示的记录
 
rs=cn.query("select  * from bmore a where "+where+" order by mid desc limit "+pageSize*(pageNow-1)+", "+pageSize);

%>

	<table cellspacing="0" border="0" style="width:100%;border-collapse:collapse;"  >
		<tr>
    <th >小说ID</th>
    <th >章节名称</th>
    <th >发布时间</th>
			<th scope="col">操作</th>		</tr>
		<%
while(rs.next()){
%>
		<tr align="center" >
  			<td><%=rs.getString("bid") %></td>
  			<td><%=rs.getString("mtitle") %></td>
  			<td><%=rs.getString("mtime") %></td>
			<td >
           <a href="<%=path %>/admin/bmore/bmore_Detail.jsp?id=<%=rs.getString("mid") %>">详细</a>&nbsp;
           <a href="<%=path %>/admin/bmore/bmore_Edit.jsp?id=<%=rs.getString("mid") %>">编辑</a>&nbsp;
           <a href="<%=path %>/bmore_Delete?id=<%=rs.getString("mid") %>">删除</a>
		</tr>
<%} %>
  
                    					   </table>
                                 		 <table width=100%>
                    			 <tbody>
                                   <tr>
                                    <td align="center">
                                           <%= Pagination.getPagination(pageNow,pageCount,rowCount,request.getRequestURI()) %>    
                                  </td>
                                  </tr>
                    </table>
					

                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

            </div>
        </div>
    </div>

</body>
</html>







